package com.example.fasttask;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;

public class TestDisplayTaskActivity extends Activity {
	boolean noTasksFound = true;
	String time = null;
	String task;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getIntent().getExtras();
        time = bundle.getString("time");
        task = getTasks(time);
        setContentView(R.layout.activity_display_task);
        
    }
	
	String getTasks(String time){ 
		int tasks = 0;
		//get all tasks with this time(in an array?)
		//if there are none
		if(0 == tasks){
			noTasksFound();
			return null;
		} else {
			//pick one at random
			// then get the name of it and display
			//this is a placeholder
			return "";
		}
	}
	
	void noTasksFound() {
		final Context context = this;
		AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
		
		alertDialogBuilder.setTitle("No tasks found for " + time);
		
		alertDialogBuilder
			.setMessage("Click OK to go back.")
			.setCancelable(false)
			.setNeutralButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int id) {
					finish();
				}
			});
		
		AlertDialog alertDialog = alertDialogBuilder.create();
		
		alertDialog.show();
	}
}
